package com.party.core.model.system;

import com.google.common.collect.Maps;

import java.util.Map;

/**
 * 系统配置参数类型
 * Created by wei.li
 *
 * @date 2017/8/4 0004
 * @time 14:49
 */
public enum SysConfigType {

    SYS_SWITCH(0, "系统开关"),

    SYS_PARAMETER(1, "系统参数");

    //状态码
    private Integer code;

    //状态值
    private String value;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    SysConfigType(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public static String getValue(Integer code){
        for (SysConfigType sysConfigType : SysConfigType.values()){
            if (code.equals(sysConfigType.getCode())){
                return sysConfigType.getValue();
            }
        }
        return null;
    }


    public static Map<Integer, String> convertMap(){
        Map<Integer, String> map = Maps.newHashMap();
        for (SysConfigType sysConfigType : SysConfigType.values()){
            map.put(sysConfigType.getCode(), sysConfigType.getValue());
        }
        return map;
    }
}
